﻿using Assets.Scripts.DL.Enemy.BaseClass.FSM;
using Assets.Scripts.DL.Enemy.CommonEnemy;
using Assets.Scripts.DL.Enemy.CommonEnemy.States.ATK;
using Assets.Scripts.DL.Enemy.CommonEnemy.States.CommonState;
using Assets.Scripts.DL.Enemy.CommonEnemy.States.Special;
using Assets.Scripts.DL.Enemy.CommonEnemy.States;
using Assets.Scripts.DL.Enemy.Wizard;
using System.Collections.Generic;

namespace Assets.Scripts.DL.Enemy.FarDistanceEnemy {
	public class FarDistanceController : Controller {
		protected override void InitAnimMgr() {
			AddAnim(StateEnum.Move, "Walk");
			AddAnim(StateEnum.Idle, "Idle");
			AddAnim(StateEnum.Bow, "Bow");
			AddAnim(StateEnum.Hurt, "Hurt");
			AddAnim(StateEnum.Die, "Die");
		}
		protected override void InitStates() {
			//base.InitStates();
			//一般状态
			var commonHfsm = new CommonStateHFSM(this, StateEnum.CommonHFSM);
			var move = new Move(this, StateEnum.Move);
			var idle = new Idle(this, StateEnum.Idle);
			commonHfsm.InitSubStates(new Dictionary<StateEnum, EnemyState<StateEnum>> {
				{StateEnum.Idle, idle},
				{StateEnum.Move, move},
				}
			);

			//Atk
			var atkHFSM = new AtkHFSM(this, StateEnum.AtkHFSM);
			var bow = new BowAtk(this, StateEnum.Bow);
			atkHFSM.InitSubStates(new Dictionary<StateEnum, EnemyState<StateEnum>> {
				{ StateEnum.Bow, bow },
			});


			//Special
			var specialHFSM = new EnemySpecialHFSM(this, StateEnum.SpecialHFSM);
			var hurt = new Hurt(this, StateEnum.Hurt);
			var die = new Die(this, StateEnum.Die);
			specialHFSM.InitSubStates(new Dictionary<StateEnum, EnemyState<StateEnum>> {
				{ StateEnum.Die, die },{StateEnum.Hurt, hurt },
			}
			);

			//Root
			_rootHFSM.InitSubStates(new Dictionary<StateEnum, EnemyState<StateEnum>> {
				{StateEnum.CommonHFSM,  commonHfsm},
				{StateEnum.AtkHFSM,  atkHFSM},
				{StateEnum.SpecialHFSM, specialHFSM },
				}
			);

		}
		protected override void InitAtkTimer() {
			//base.InitAtkTimer();
			StateData.AtkCdRecoder = new Dictionary<StateEnum, Timer> {
				{StateEnum.Bow, new Timer() },
			};
		}
	}
}
